package com.dpiinc.TechPage

import android.content.Context
import android.util.DisplayMetrics
import android.widget.Toast
import android.view.Gravity



fun Context.toast(messageId: Int) {
    Toast.makeText(this, messageId, Toast.LENGTH_SHORT).show()
}

fun Context.toast(message: String) {
    val toast = Toast.makeText(this, message, Toast.LENGTH_SHORT)
    toast.setGravity(Gravity.CENTER, 0, 0)
    toast.show()
}

fun Context.toastIfDebug(messageId: Int) {
    if (AIWriteApplication.isDebug()) {
        Toast.makeText(this, messageId, Toast.LENGTH_SHORT).show()
    }
}

fun Context.toastIfDebug(message: String) {
    if (AIWriteApplication.isDebug()) {
        Toast.makeText(this, message, Toast.LENGTH_SHORT).show()
    }
}

fun Context.isDebug(): Boolean {
    return AIWriteApplication.isDebug()
}

inline val Context.displayMetrics: DisplayMetrics
    get() = this.resources.displayMetrics

inline val Context.screenWidth: Int
    get() = this.displayMetrics.widthPixels

inline val Context.screenHeight: Int
    get() = this.displayMetrics.heightPixels

inline val Context.screenDensity: Float
    get() = this.displayMetrics.density